The minimal app
This is the smallest possible RTIC application:
//! examples/smallest.rs
#![no_main]
#![no_std]
#![deny(warnings)]
#![deny(unsafe_code)]
#![deny(missing_docs)]
use core::panic::PanicInfo;
use cortex_m_semihosting::debug;
use rtic::app;
#[app(device = lm3s6965)]
mod app {
use super::*;
#[shared]
struct Shared {}
#[local]
struct Local {}
#[init]
fn init(_: init::Context) -> (Shared, Local) {
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
(Shared {}, Local {})
}
}
#[panic_handler]
fn panic_handler(_: &PanicInfo) -> ! {
debug::exit(debug::EXIT_FAILURE);
loop {}
}
RTIC is designed with resource efficiency in mind. RTIC itself does not rely on any dynamic memory allocation, thus RAM requirement is dependent only on the application. The flash memory footprint is below 1kB including the interrupt vector table.
For a minimal example you can expect something like:
$ cargo xtask size --example smallest --backend thumbv7
text data bss dec hex filename
604 0 4 608 260 smallest