Improve performance for ELRS SX1280 SPI callbacks and SPI/ELRS handlers. (#11460)
commit738ed32cff89104e91f7ba8a0f44b3ab33d10121
authorDominic Clifton <dominic.clifton@cleanflight.com>
Tue, 10 Jan 2023 19:33:06 +0000 (10 20:33 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Jan 2023 19:33:06 +0000 (11 06:33 +1100)
treedf4073f42c6da52b3a43dd65eff7097eb9650a2e
parent449480520214a3e192744dfc9d002da0cc6dccbf
Improve performance for ELRS SX1280 SPI callbacks and SPI/ELRS handlers. (#11460)

* SPI - Mark the SPI IRQ handler as FAST_IRQ_HANDLER.

Since it's used by both the gyro code, at 8k (or 2x8k on dual gyro
boards) having it in RAM removes a significant amount of potential flash
latency.

It is also used by the ELRS SPI code.  The ELRS code runs at 500hz, but
each cycle uses multiple SPI transfers, for clear irq, read,
start-recieving, change-frequency, etc. I.e. invokd at least 1000hz in
addition to gyro reads.

* ELRS - Move some frequently used functions to RAM and mark some irq
handlers as FAST.

* SPI/LL - Move some frequently called code to FAST_CODE.

Also remove some invalid characters that Eclipse with encoding as UTF-8
complained about.

* SPI - Mark the spiRx and spiTx dma handlers as FAST_IRQ_HANDLER.

* Filter - move nullFilterApply out of FAST_CODE.

Since it doesn't do anything, it doesn't need to be fast.  Instead we
keep more `fast` RAM for other code that really benefits from being in
fast RAM.

There is a slight penalty to jump into slower RAM.

* Gyro - Move `performGyroCalibration`out of 'fast' ram.

On F7X2 it was being inlined, saved 478 bytes of ITCM.

* Prevent handling of crash recovery handling, not detection of crash
recovery, from being inlined to save ITCM for code that runs more
frequently.
src/main/common/filter.c
src/main/drivers/bus_spi.c
src/main/drivers/bus_spi_ll.c
src/main/drivers/rx/rx_sx1280.c
src/main/flight/pid.c
src/main/sensors/gyro.c