diff --git a/Cargo.toml b/Cargo.toml index 3680bb0..3233b94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ codegen-units = 1 debug = 2 debug-assertions = true incremental = false -opt-level = 's' +opt-level = 3 lto = "fat" overflow-checks = true @@ -71,7 +71,7 @@ incremental = false lto = 'fat' # opt level needs to be benchmarked after every major feature # due to the changes in binary size and alignment -opt-level = 's' +opt-level = 3 overflow-checks = false # do not optimize proc-macro crates = faster builds from scratch diff --git a/src/filter.rs b/src/filter.rs index b13c915..4ab0128 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -179,7 +179,7 @@ pub struct KalmanState { } impl KalmanState { - // runs kalman filter + #[inline(never)] #[link_section = ".time_critical.run_kalman"] pub fn run_kalman( &mut self, @@ -292,6 +292,7 @@ impl KalmanState { /// output at the rim longer when released. /// /// Output is a tuple of the x and y positions. +#[inline(never)] #[link_section = ".time_critical.run_waveshaping"] pub fn run_waveshaping( x_pos: f32, diff --git a/src/input.rs b/src/input.rs index f70a0cc..874e17d 100644 --- a/src/input.rs +++ b/src/input.rs @@ -82,6 +82,7 @@ pub enum StickAxis { YAxis, } +#[inline(never)] #[link_section = ".time_critical.read_ext_adc"] pub fn read_ext_adc< 'a, @@ -125,6 +126,7 @@ pub fn read_ext_adc< /// Gets the average stick state over a 1ms interval in a non-blocking fashion. /// Will wait until end_time is reached before continuing after reading the ADCs. #[allow(clippy::too_many_arguments)] +#[inline(never)] #[link_section = ".time_critical.update_stick_states"] async fn update_stick_states( current_stick_state: &StickState, @@ -540,6 +542,7 @@ pub async fn update_button_state_task( /// /// Has to run on core0 because it makes use of SPI0. #[embassy_executor::task] +#[inline(never)] #[link_section = ".time_critical.update_stick_states_task"] pub async fn update_stick_states_task( spi: Spi<'static, SPI0, embassy_rp::spi::Blocking>, diff --git a/src/stick.rs b/src/stick.rs index 1207eaa..09f065d 100644 --- a/src/stick.rs +++ b/src/stick.rs @@ -882,6 +882,7 @@ pub fn calc_stick_values(angle: f32) -> (f32, f32) { (x, y) } +#[inline(never)] #[link_section = ".time_critical.linearize"] pub fn linearize(point: f32, coefficients: &[f32; NUM_COEFFS]) -> f32 { coefficients[0] * (point * point * point) @@ -890,6 +891,7 @@ pub fn linearize(point: f32, coefficients: &[f32; NUM_COEFFS]) -> f32 { + coefficients[3] } +#[inline(never)] #[link_section = ".time_critical.notch_remap"] pub fn notch_remap( x_in: f32,