From 3733640c086b8e3201d11d53d092dffea9042fb7 Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Tue, 22 May 2018 11:58:17 +0300 Subject: [PATCH] Changed NOINLINE to be applied conditionally on ITCM presence --- src/main/fc/fc_core.c | 2 +- src/main/fc/fc_rc.c | 4 ++-- src/main/flight/mixer.c | 2 +- src/main/main.c | 2 +- src/main/sensors/gyro.c | 6 +++--- src/main/target/common_fc_pre.h | 2 ++ src/main/target/common_osd_slave.h | 1 + src/test/unit/platform.h | 1 + 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index 92552132a0..c6d4026a7e 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -886,7 +886,7 @@ static void subTaskPidController(timeUs_t currentTimeUs) #endif } -static NOINLINE void subTaskMainSubprocesses(timeUs_t currentTimeUs) +static FAST_CODE_NOINLINE void subTaskMainSubprocesses(timeUs_t currentTimeUs) { uint32_t startTime = 0; if (debugMode == DEBUG_PIDLOOP) { diff --git a/src/main/fc/fc_rc.c b/src/main/fc/fc_rc.c index e34aaa65ff..d4f1e8ae96 100644 --- a/src/main/fc/fc_rc.c +++ b/src/main/fc/fc_rc.c @@ -180,7 +180,7 @@ static void checkForThrottleErrorResetState(uint16_t rxRefreshRate) } } -FAST_CODE NOINLINE void processRcCommand(void) +FAST_CODE FAST_CODE_NOINLINE void processRcCommand(void) { static float rcCommandInterp[4]; static float rcStepSize[4]; @@ -266,7 +266,7 @@ FAST_CODE NOINLINE void processRcCommand(void) } } -FAST_CODE NOINLINE void updateRcCommands(void) +FAST_CODE FAST_CODE_NOINLINE void updateRcCommands(void) { // PITCH & ROLL only dynamic PID adjustment, depending on throttle value int32_t prop; diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index bc4d94764e..b8baec6016 100644 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -735,7 +735,7 @@ float applyThrottleLimit(float throttle) return throttle; } -NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensation) +FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensation) { if (isFlipOverAfterCrashMode()) { applyFlipOverAfterCrashModeToMotors(); diff --git a/src/main/main.c b/src/main/main.c index 8e6b179100..9c24fe197c 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -38,7 +38,7 @@ int main(void) return 0; } -void FAST_CODE NOINLINE run(void) +void FAST_CODE FAST_CODE_NOINLINE run(void) { while (true) { scheduler(); diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 9af0a71ef5..c8e013b642 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -972,7 +972,7 @@ FAST_CODE int32_t gyroSlewLimiter(gyroSensor_t *gyroSensor, int axis) #endif #ifdef USE_GYRO_OVERFLOW_CHECK -static NOINLINE void handleOverflow(gyroSensor_t *gyroSensor, timeUs_t currentTimeUs) +static FAST_CODE_NOINLINE void handleOverflow(gyroSensor_t *gyroSensor, timeUs_t currentTimeUs) { const float gyroOverflowResetRate = GYRO_OVERFLOW_RESET_THRESHOLD * gyroSensor->gyroDev.scale; if ((abs(gyro.gyroADCf[X]) < gyroOverflowResetRate) @@ -1024,7 +1024,7 @@ static FAST_CODE void checkForOverflow(gyroSensor_t *gyroSensor, timeUs_t curren #endif // USE_GYRO_OVERFLOW_CHECK #ifdef USE_YAW_SPIN_RECOVERY -static NOINLINE void handleYawSpin(gyroSensor_t *gyroSensor, timeUs_t currentTimeUs) +static FAST_CODE_NOINLINE void handleYawSpin(gyroSensor_t *gyroSensor, timeUs_t currentTimeUs) { const float yawSpinResetRate = gyroConfig()->yaw_spin_threshold - 100.0f; if (abs(gyro.gyroADCf[Z]) < yawSpinResetRate) { @@ -1062,7 +1062,7 @@ static FAST_CODE void checkForYawSpin(gyroSensor_t *gyroSensor, timeUs_t current } #endif // USE_YAW_SPIN_RECOVERY -static FAST_CODE NOINLINE void gyroUpdateSensor(gyroSensor_t *gyroSensor, timeUs_t currentTimeUs) +static FAST_CODE FAST_CODE_NOINLINE void gyroUpdateSensor(gyroSensor_t *gyroSensor, timeUs_t currentTimeUs) { if (!gyroSensor->gyroDev.readFn(&gyroSensor->gyroDev)) { return; diff --git a/src/main/target/common_fc_pre.h b/src/main/target/common_fc_pre.h index bbcf6c6dc5..c94df0015c 100644 --- a/src/main/target/common_fc_pre.h +++ b/src/main/target/common_fc_pre.h @@ -96,8 +96,10 @@ #ifdef USE_ITCM_RAM #define FAST_CODE __attribute__((section(".tcm_code"))) +#define FAST_CODE_NOINLINE NOINLINE #else #define FAST_CODE +#define FAST_CODE_NOINLINE #endif // USE_ITCM_RAM #ifdef USE_FAST_RAM diff --git a/src/main/target/common_osd_slave.h b/src/main/target/common_osd_slave.h index 1f155d940d..e85c1f523d 100644 --- a/src/main/target/common_osd_slave.h +++ b/src/main/target/common_osd_slave.h @@ -60,6 +60,7 @@ #endif #define FAST_CODE +#define FAST_CODE_NOINLINE #define FAST_RAM_ZERO_INIT #define FAST_RAM diff --git a/src/test/unit/platform.h b/src/test/unit/platform.h index 940d771b68..45070ca9c9 100644 --- a/src/test/unit/platform.h +++ b/src/test/unit/platform.h @@ -27,6 +27,7 @@ #define NOINLINE #define FAST_CODE +#define FAST_CODE_NOINLINE #define FAST_RAM_ZERO_INIT #define FAST_RAM