feat: don't inline time-critical functions
All checks were successful
Code quality / check (pull_request) Successful in 2m7s
Publish nightly release / build (push) Successful in 2m41s

This commit is contained in:
Naxdy 2024-04-30 13:59:52 +02:00
parent a09d21b4fd
commit b6b5bb25a7
Signed by: Naxdy
GPG key ID: CC15075846BCE91B
4 changed files with 9 additions and 3 deletions

View file

@ -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

View file

@ -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,

View file

@ -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>,

View file

@ -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,