-
Notifications
You must be signed in to change notification settings - Fork 242
Closed
Labels
#[cfg]Issues related to #[cfg] attributesIssues related to #[cfg] attributes
Description
Modifying cfg-whole-task example:
//! examples/cfg-whole-task.rs
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
use panic_semihosting as _;
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
mod app {
use cortex_m_semihosting::debug;
#[shared]
struct Shared {
#[cfg(never)]
unused: u32,
count: u32,
}
#[local]
struct Local {
}
#[init]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
(
Shared {
#[cfg(never)]
unused: 1,
count: 0,
},
Local {
},
init::Monotonics(),
)
}
#[idle]
fn idle(_: idle::Context) -> ! {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
loop {
cortex_m::asm::nop();
}
}
#[task(binds=UART2, shared = [count])]
fn foo(mut cx: foo::Context) {
cx.shared.count.lock(|count| *count += 1);
}
// The whole task should disappear,
// currently still present in the Tasks enum
#[cfg(never))]
#[task(binds=UART1, shared = [count])]
fn foo2(mut cx: foo2::Context) {
cx.shared.count.lock(|count| *count += 10);
}
}
building it yields:
error[E0412]: cannot find type `Context` in module `foo2`
--> examples/cfg-whole-task.rs:10:1
|
10 | #[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `foo2`
|
= note: this error originates in the attribute macro `rtic::app` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
12 | use core::task::Context;
|
12 | use crate::app::foo::Context;
|
12 | use crate::app::idle::Context;
|
12 | use crate::app::init::Context;
|
For more information about this error, try `rustc --explain E0412`.
error: could not compile `cortex-m-rtic` due to previous error
macro expansion:
#![feature(prelude_import)]
//! examples/cfg-whole-task.rs
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
#[prelude_import]
use core::prelude::rust_2021::*;
#[macro_use]
extern crate core;
#[macro_use]
extern crate compiler_builtins;
use panic_semihosting as _;
/// The RTIC application module
pub mod app {
/// Always include the device crate which contains the vector table
use lm3s6965 as you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml;
use cortex_m_semihosting::debug;
/// User code from within the module
/// User code end
#[inline(always)]
#[allow(non_snake_case)]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
(Shared { count: 0 }, Local {}, init::Monotonics())
}
#[allow(non_snake_case)]
fn idle(_: idle::Context) -> ! {
use rtic::Mutex as _;
use rtic::mutex::prelude::*;
debug::exit(debug::EXIT_SUCCESS);
loop {
cortex_m::asm::nop();
}
}
#[allow(non_snake_case)]
fn foo(mut cx: foo::Context) {
use rtic::Mutex as _;
use rtic::mutex::prelude::*;
cx.shared.count.lock(|count| *count += 1);
}
#[allow(non_snake_case)]
fn foo2(mut cx: foo2::Context) {
use rtic::Mutex as _;
use rtic::mutex::prelude::*;
cx.shared.count.lock(|count| *count += 10);
}
struct Shared {
count: u32,
}
struct Local {}
/// Monotonics used by the system
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_Monotonics();
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_init_Context<'a> {
/// Core (Cortex-M) peripherals
pub core: rtic::export::Peripherals,
/// Device peripherals
pub device: lm3s6965::Peripherals,
/// Critical section token for init
pub cs: rtic::export::CriticalSection<'a>,
}
impl<'a> __rtic_internal_init_Context<'a> {
#[inline(always)]
pub unsafe fn new(core: rtic::export::Peripherals) -> Self {
__rtic_internal_init_Context {
device: lm3s6965::Peripherals::steal(),
cs: rtic::export::CriticalSection::new(),
core,
}
}
}
#[allow(non_snake_case)]
///Initialization function
pub mod init {
pub use super::__rtic_internal_Monotonics as Monotonics;
pub use super::__rtic_internal_init_Context as Context;
}
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_idle_Context {}
impl __rtic_internal_idle_Context {
#[inline(always)]
pub unsafe fn new(priority: &rtic::export::Priority) -> Self {
__rtic_internal_idle_Context {}
}
}
#[allow(non_snake_case)]
///Idle loop
pub mod idle {
pub use super::__rtic_internal_idle_Context as Context;
}
mod shared_resources {
use rtic::export::Priority;
#[doc(hidden)]
#[allow(non_camel_case_types)]
pub struct count_that_needs_to_be_locked<'a> {
priority: &'a Priority,
}
impl<'a> count_that_needs_to_be_locked<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a Priority) -> Self {
count_that_needs_to_be_locked { priority }
}
#[inline(always)]
pub unsafe fn priority(&self) -> &Priority {
self.priority
}
}
}
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
///Shared resources `foo` has access to
pub struct __rtic_internal_fooSharedResources<'a> {
pub count: shared_resources::count_that_needs_to_be_locked<'a>,
}
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_foo_Context<'a> {
/// Shared Resources this task has access to
pub shared: foo::SharedResources<'a>,
}
impl<'a> __rtic_internal_foo_Context<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
__rtic_internal_foo_Context {
shared: foo::SharedResources::new(priority),
}
}
}
#[allow(non_snake_case)]
///Hardware task
pub mod foo {
#[doc(inline)]
pub use super::__rtic_internal_fooSharedResources as SharedResources;
pub use super::__rtic_internal_foo_Context as Context;
}
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
///Shared resources `foo2` has access to
pub struct __rtic_internal_foo2SharedResources<'a> {
pub count: shared_resources::count_that_needs_to_be_locked<'a>,
}
#[allow(non_snake_case)]
///Hardware task
pub mod foo2 {
#[doc(inline)]
pub use super::__rtic_internal_foo2SharedResources as SharedResources;
}
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
#[link_section = ".uninit.rtic1"]
static __rtic_internal_shared_resource_count: rtic::RacyCell<core::mem::MaybeUninit<u32>> =
rtic::RacyCell::new(core::mem::MaybeUninit::uninit());
impl<'a> rtic::Mutex for shared_resources::count_that_needs_to_be_locked<'a> {
type T = u32;
#[inline(always)]
fn lock<RTIC_INTERNAL_R>(
&mut self,
f: impl FnOnce(&mut u32) -> RTIC_INTERNAL_R,
) -> RTIC_INTERNAL_R {
/// Priority ceiling
const CEILING: u8 = 1u8;
unsafe {
rtic::export::lock(
__rtic_internal_shared_resource_count.get_mut() as *mut _,
self.priority(),
CEILING,
lm3s6965::NVIC_PRIO_BITS,
&__rtic_internal_MASKS,
f,
)
}
}
}
#[doc(hidden)]
#[allow(non_upper_case_globals)]
const __rtic_internal_MASK_CHUNKS: usize = rtic::export::compute_mask_chunks([
lm3s6965::Interrupt::UART2 as u32,
lm3s6965::Interrupt::UART1 as u32,
]);
#[doc(hidden)]
#[allow(non_upper_case_globals)]
const __rtic_internal_MASKS: [rtic::export::Mask<__rtic_internal_MASK_CHUNKS>; 3] = [
rtic::export::create_mask([
lm3s6965::Interrupt::UART2 as u32,
lm3s6965::Interrupt::UART1 as u32,
]),
rtic::export::create_mask([]),
rtic::export::create_mask([]),
];
#[allow(non_snake_case)]
#[no_mangle]
unsafe fn UART2() {
const PRIORITY: u8 = 1u8;
rtic::export::run(PRIORITY, || {
foo(foo::Context::new(&rtic::export::Priority::new(PRIORITY)))
});
}
impl<'a> __rtic_internal_fooSharedResources<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
__rtic_internal_fooSharedResources {
count: shared_resources::count_that_needs_to_be_locked::new(priority),
}
}
}
impl<'a> __rtic_internal_foo2SharedResources<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
__rtic_internal_foo2SharedResources {
count: shared_resources::count_that_needs_to_be_locked::new(priority),
}
}
}
#[doc(hidden)]
mod rtic_ext {
use super::*;
#[no_mangle]
unsafe extern "C" fn main() -> ! {
rtic::export::assert_send::<u32>();
const _CONST_CHECK: () = {
if !rtic::export::have_basepri() {
if (lm3s6965::Interrupt::UART2 as usize) >= (__rtic_internal_MASK_CHUNKS * 32) {
::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
&["An interrupt out of range is used while in armv6 or armv8m.base"],
&[],
));
}
if (lm3s6965::Interrupt::UART1 as usize) >= (__rtic_internal_MASK_CHUNKS * 32) {
::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
&["An interrupt out of range is used while in armv6 or armv8m.base"],
&[],
));
}
} else {
}
};
let _ = _CONST_CHECK;
rtic::export::interrupt::disable();
let mut core: rtic::export::Peripherals = rtic::export::Peripherals::steal().into();
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SSI0;
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::QEI0;
const _: () = if (1 << lm3s6965::NVIC_PRIO_BITS) < 1u8 as usize {
:: core :: panicking :: panic_fmt (:: core :: fmt :: Arguments :: new_v1 (& ["Maximum priority used by interrupt vector \'UART2\' is more than supported by hardware"] , & [])) ;
};
core.NVIC.set_priority(
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UART2,
rtic::export::logical2hw(1u8, lm3s6965::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UART2,
);
const _: () = if (1 << lm3s6965::NVIC_PRIO_BITS) < 1u8 as usize {
:: core :: panicking :: panic_fmt (:: core :: fmt :: Arguments :: new_v1 (& ["Maximum priority used by interrupt vector \'UART1\' is more than supported by hardware"] , & [])) ;
};
core.NVIC.set_priority(
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UART1,
rtic::export::logical2hw(1u8, lm3s6965::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::UART1,
);
#[inline(never)]
fn __rtic_init_resources<F>(f: F)
where
F: FnOnce(),
{
f();
}
__rtic_init_resources(|| {
let (shared_resources, local_resources, mut monotonics) =
init(init::Context::new(core.into()));
__rtic_internal_shared_resource_count
.get_mut()
.write(core::mem::MaybeUninit::new(shared_resources.count));
rtic::export::interrupt::enable();
});
idle(idle::Context::new(&rtic::export::Priority::new(0)))
}
}
}
cfg-whole-task without modifications can be compiled fine, with following expansion:
#![feature(prelude_import)]
//! examples/cfg-whole-task.rs
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
#[prelude_import]
use core::prelude::rust_2021::*;
#[macro_use]
extern crate core;
#[macro_use]
extern crate compiler_builtins;
use panic_semihosting as _;
/// The RTIC application module
pub mod app {
/// Always include the device crate which contains the vector table
use lm3s6965 as you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml;
use cortex_m_semihosting::debug;
#[cfg(debug_assertions)]
use cortex_m_semihosting::hprintln;
/// User code from within the module
/// User code end
#[inline(always)]
#[allow(non_snake_case)]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
foo::spawn().unwrap();
foo::spawn().unwrap();
(Shared { count: 0 }, Local {}, init::Monotonics())
}
#[allow(non_snake_case)]
fn idle(_: idle::Context) -> ! {
use rtic::Mutex as _;
use rtic::mutex::prelude::*;
debug::exit(debug::EXIT_SUCCESS);
loop {
cortex_m::asm::nop();
}
}
#[allow(non_snake_case)]
fn foo(mut _cx: foo::Context) {
use rtic::Mutex as _;
use rtic::mutex::prelude::*;
#[cfg(debug_assertions)]
{
_cx.shared.count.lock(|count| *count += 1);
log::spawn(_cx.shared.count.lock(|count| *count)).unwrap();
}
}
#[cfg(debug_assertions)]
#[allow(non_snake_case)]
fn log(_: log::Context, n: u32) {
use rtic::Mutex as _;
use rtic::mutex::prelude::*;
::cortex_m_semihosting::export::hstdout_fmt(::core::fmt::Arguments::new_v1(
&["foo has been called ", " time", "\n"],
&[
::core::fmt::ArgumentV1::new_display(&n),
::core::fmt::ArgumentV1::new_display(&if n == 1 { "" } else { "s" }),
],
))
.ok();
}
struct Shared {
count: u32,
}
struct Local {}
/// Monotonics used by the system
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_Monotonics();
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_init_Context<'a> {
/// Core (Cortex-M) peripherals
pub core: rtic::export::Peripherals,
/// Device peripherals
pub device: lm3s6965::Peripherals,
/// Critical section token for init
pub cs: rtic::export::CriticalSection<'a>,
}
impl<'a> __rtic_internal_init_Context<'a> {
#[inline(always)]
pub unsafe fn new(core: rtic::export::Peripherals) -> Self {
__rtic_internal_init_Context {
device: lm3s6965::Peripherals::steal(),
cs: rtic::export::CriticalSection::new(),
core,
}
}
}
#[allow(non_snake_case)]
///Initialization function
pub mod init {
pub use super::__rtic_internal_Monotonics as Monotonics;
pub use super::__rtic_internal_init_Context as Context;
}
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_idle_Context {}
impl __rtic_internal_idle_Context {
#[inline(always)]
pub unsafe fn new(priority: &rtic::export::Priority) -> Self {
__rtic_internal_idle_Context {}
}
}
#[allow(non_snake_case)]
///Idle loop
pub mod idle {
pub use super::__rtic_internal_idle_Context as Context;
}
mod shared_resources {
use rtic::export::Priority;
#[doc(hidden)]
#[allow(non_camel_case_types)]
pub struct count_that_needs_to_be_locked<'a> {
priority: &'a Priority,
}
impl<'a> count_that_needs_to_be_locked<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a Priority) -> Self {
count_that_needs_to_be_locked { priority }
}
#[inline(always)]
pub unsafe fn priority(&self) -> &Priority {
self.priority
}
}
}
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
///Shared resources `foo` has access to
pub struct __rtic_internal_fooSharedResources<'a> {
pub count: shared_resources::count_that_needs_to_be_locked<'a>,
}
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_foo_Context<'a> {
/// Shared Resources this task has access to
pub shared: foo::SharedResources<'a>,
}
impl<'a> __rtic_internal_foo_Context<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
__rtic_internal_foo_Context {
shared: foo::SharedResources::new(priority),
}
}
}
/// Spawns the task directly
pub fn __rtic_internal_foo_spawn() -> Result<(), ()> {
let input = ();
unsafe {
if let Some(index) = rtic::export::interrupt::free(|_| {
(&mut *__rtic_internal_foo_FQ.get_mut()).dequeue()
}) {
(&mut *__rtic_internal_foo_INPUTS.get_mut())
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
rtic::export::interrupt::free(|_| {
(&mut *__rtic_internal_P1_RQ.get_mut()).enqueue_unchecked((P1_T::foo, index));
});
rtic::pend(lm3s6965::interrupt::SSI0);
Ok(())
} else {
Err(input)
}
}
}
#[allow(non_snake_case)]
///Software task
pub mod foo {
#[doc(inline)]
pub use super::__rtic_internal_fooSharedResources as SharedResources;
pub use super::__rtic_internal_foo_Context as Context;
pub use super::__rtic_internal_foo_spawn as spawn;
}
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
///Shared resources `foo2` has access to
pub struct __rtic_internal_foo2SharedResources<'a> {
pub count: shared_resources::count_that_needs_to_be_locked<'a>,
}
#[cfg(debug_assertions)]
/// Execution context
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
pub struct __rtic_internal_log_Context {}
#[cfg(debug_assertions)]
impl __rtic_internal_log_Context {
#[inline(always)]
pub unsafe fn new(priority: &rtic::export::Priority) -> Self {
__rtic_internal_log_Context {}
}
}
#[cfg(debug_assertions)]
/// Spawns the task directly
pub fn __rtic_internal_log_spawn(_0: u32) -> Result<(), u32> {
let input = _0;
unsafe {
if let Some(index) = rtic::export::interrupt::free(|_| {
(&mut *__rtic_internal_log_FQ.get_mut()).dequeue()
}) {
(&mut *__rtic_internal_log_INPUTS.get_mut())
.get_unchecked_mut(usize::from(index))
.as_mut_ptr()
.write(input);
rtic::export::interrupt::free(|_| {
(&mut *__rtic_internal_P1_RQ.get_mut()).enqueue_unchecked((P1_T::log, index));
});
rtic::pend(lm3s6965::interrupt::SSI0);
Ok(())
} else {
Err(input)
}
}
}
#[allow(non_snake_case)]
#[cfg(debug_assertions)]
///Software task
pub mod log {
#[cfg(debug_assertions)]
pub use super::__rtic_internal_log_Context as Context;
#[cfg(debug_assertions)]
pub use super::__rtic_internal_log_spawn as spawn;
}
/// app module
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
#[link_section = ".uninit.rtic0"]
static __rtic_internal_shared_resource_count: rtic::RacyCell<core::mem::MaybeUninit<u32>> =
rtic::RacyCell::new(core::mem::MaybeUninit::uninit());
impl<'a> rtic::Mutex for shared_resources::count_that_needs_to_be_locked<'a> {
type T = u32;
#[inline(always)]
fn lock<RTIC_INTERNAL_R>(
&mut self,
f: impl FnOnce(&mut u32) -> RTIC_INTERNAL_R,
) -> RTIC_INTERNAL_R {
/// Priority ceiling
const CEILING: u8 = 1u8;
unsafe {
rtic::export::lock(
__rtic_internal_shared_resource_count.get_mut() as *mut _,
self.priority(),
CEILING,
lm3s6965::NVIC_PRIO_BITS,
&__rtic_internal_MASKS,
f,
)
}
}
}
#[doc(hidden)]
#[allow(non_upper_case_globals)]
const __rtic_internal_MASK_CHUNKS: usize =
rtic::export::compute_mask_chunks([lm3s6965::Interrupt::SSI0 as u32]);
#[doc(hidden)]
#[allow(non_upper_case_globals)]
const __rtic_internal_MASKS: [rtic::export::Mask<__rtic_internal_MASK_CHUNKS>; 3] = [
rtic::export::create_mask([lm3s6965::Interrupt::SSI0 as u32]),
rtic::export::create_mask([]),
rtic::export::create_mask([]),
];
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
static __rtic_internal_foo_FQ: rtic::RacyCell<rtic::export::SCFQ<3>> =
rtic::RacyCell::new(rtic::export::Queue::new());
#[link_section = ".uninit.rtic2"]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
static __rtic_internal_foo_INPUTS: rtic::RacyCell<[core::mem::MaybeUninit<()>; 2]> =
rtic::RacyCell::new([
core::mem::MaybeUninit::uninit(),
core::mem::MaybeUninit::uninit(),
]);
impl<'a> __rtic_internal_fooSharedResources<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
__rtic_internal_fooSharedResources {
count: shared_resources::count_that_needs_to_be_locked::new(priority),
}
}
}
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
static __rtic_internal_foo2_FQ: rtic::RacyCell<rtic::export::SCFQ<3>> =
rtic::RacyCell::new(rtic::export::Queue::new());
#[link_section = ".uninit.rtic3"]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
static __rtic_internal_foo2_INPUTS: rtic::RacyCell<[core::mem::MaybeUninit<()>; 2]> =
rtic::RacyCell::new([
core::mem::MaybeUninit::uninit(),
core::mem::MaybeUninit::uninit(),
]);
impl<'a> __rtic_internal_foo2SharedResources<'a> {
#[inline(always)]
pub unsafe fn new(priority: &'a rtic::export::Priority) -> Self {
__rtic_internal_foo2SharedResources {
count: shared_resources::count_that_needs_to_be_locked::new(priority),
}
}
}
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
static __rtic_internal_log_FQ: rtic::RacyCell<rtic::export::SCFQ<3>> =
rtic::RacyCell::new(rtic::export::Queue::new());
#[link_section = ".uninit.rtic4"]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
#[doc(hidden)]
static __rtic_internal_log_INPUTS: rtic::RacyCell<[core::mem::MaybeUninit<u32>; 2]> =
rtic::RacyCell::new([
core::mem::MaybeUninit::uninit(),
core::mem::MaybeUninit::uninit(),
]);
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
#[doc(hidden)]
pub enum P1_T {
foo,
#[cfg(debug_assertions)]
log,
}
#[automatically_derived]
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
impl ::core::clone::Clone for P1_T {
#[inline]
fn clone(&self) -> P1_T {
*self
}
}
#[automatically_derived]
#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
impl ::core::marker::Copy for P1_T {}
#[doc(hidden)]
#[allow(non_camel_case_types)]
#[allow(non_upper_case_globals)]
static __rtic_internal_P1_RQ: rtic::RacyCell<rtic::export::SCRQ<P1_T, 7>> =
rtic::RacyCell::new(rtic::export::Queue::new());
#[allow(non_snake_case)]
///Interrupt handler to dispatch tasks at priority 1
#[no_mangle]
unsafe fn SSI0() {
/// The priority of this interrupt handler
const PRIORITY: u8 = 1u8;
rtic::export::run(PRIORITY, || {
while let Some((task, index)) =
(&mut *__rtic_internal_P1_RQ.get_mut()).split().1.dequeue()
{
match task {
P1_T::foo => {
let () = (&*__rtic_internal_foo_INPUTS.get())
.get_unchecked(usize::from(index))
.as_ptr()
.read();
(&mut *__rtic_internal_foo_FQ.get_mut())
.split()
.0
.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
foo(foo::Context::new(priority))
}
#[cfg(debug_assertions)]
P1_T::log => {
let _0 = (&*__rtic_internal_log_INPUTS.get())
.get_unchecked(usize::from(index))
.as_ptr()
.read();
(&mut *__rtic_internal_log_FQ.get_mut())
.split()
.0
.enqueue_unchecked(index);
let priority = &rtic::export::Priority::new(PRIORITY);
log(log::Context::new(priority), _0)
}
}
}
});
}
#[doc(hidden)]
mod rtic_ext {
use super::*;
#[no_mangle]
unsafe extern "C" fn main() -> ! {
rtic::export::assert_send::<u32>();
const _CONST_CHECK: () = {
if !rtic::export::have_basepri() {
} else {
}
};
let _ = _CONST_CHECK;
rtic::export::interrupt::disable();
(0..2u8).for_each(|i| (&mut *__rtic_internal_foo_FQ.get_mut()).enqueue_unchecked(i));
(0..2u8).for_each(|i| (&mut *__rtic_internal_foo2_FQ.get_mut()).enqueue_unchecked(i));
(0..2u8).for_each(|i| (&mut *__rtic_internal_log_FQ.get_mut()).enqueue_unchecked(i));
let mut core: rtic::export::Peripherals = rtic::export::Peripherals::steal().into();
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SSI0;
let _ = you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::QEI0;
const _: () = if (1 << lm3s6965::NVIC_PRIO_BITS) < 1u8 as usize {
:: core :: panicking :: panic_fmt (:: core :: fmt :: Arguments :: new_v1 (& ["Maximum priority used by interrupt vector \'SSI0\' is more than supported by hardware"] , & [])) ;
};
core.NVIC.set_priority(
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SSI0,
rtic::export::logical2hw(1u8, lm3s6965::NVIC_PRIO_BITS),
);
rtic::export::NVIC::unmask(
you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::interrupt::SSI0,
);
#[inline(never)]
fn __rtic_init_resources<F>(f: F)
where
F: FnOnce(),
{
f();
}
__rtic_init_resources(|| {
let (shared_resources, local_resources, mut monotonics) =
init(init::Context::new(core.into()));
__rtic_internal_shared_resource_count
.get_mut()
.write(core::mem::MaybeUninit::new(shared_resources.count));
rtic::export::interrupt::enable();
});
idle(idle::Context::new(&rtic::export::Priority::new(0)))
}
}
}
As one can see, when no interrupts are used task disappears completely.
David-OConnor
Metadata
Metadata
Assignees
Labels
#[cfg]Issues related to #[cfg] attributesIssues related to #[cfg] attributes